home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1993-11-29 | 6.5 KB | 168 lines |
- >Convert_4 Ver. 3.3
- By D.J.Holden Jan 1990
- Converts BBC View, Viewsheet or Viewstore
- ROM into a Module for the Archimedes
- Expects to find Headcode in !Convert dir and ROM in parent dir
- Works for;
- View A3, B3.1, B3.11 (bug in earlier Bxx version fixed)
- ViewSheet 1.0, B1.0, B1.01
- Viewstore 1.1, 1.13
- Set rom$ to View, VSheet or VStore
- Must be these names exactly with same case
- rom$="VSheet":ver$=""
- buffer% &4C00, code% &100
- "OS_File",17,"<Obey$Dir>.^."+rom$
- found%
- found%<> 1
- "Unable to find "rom$" ROM.":
- "OS_File",17,"<Obey$Dir>.Header"
- found%,,,,h_len%
- found%<>1
- Unable to find Header code.":
- "OS_File",17,"<Obey$Dir>.Patch_Code"
- found%,,,,p_len%
- found%<>1
- Unable to find 6502 Patch Code.":
- rom%=buffer%+h_len%
- "OS_File",16,"<Obey$Dir>.Header",buffer%,0
- "OS_File",16,"<Obey$Dir>.^."+rom$,rom%,0
- "OS_File",16,"<Obey$Dir>.Patch_Code",rom%+&4000,0
- assemble
- Ensure ROM type byte identifies it as a language so it will
- work properly with 65Tube. This may have been changed for SWR
- rom%?6=&C2
- rom%!16=&42007465
- rom%!20=&00302E31:
- rom$="VSheet"
- sheet_B1
- rom%!16=&42007465
- rom%!20=&31302E31:
- rom$="VSheet"
- full:ver$=" View Sheet B1.1"
- rom%!16=&31007465
- rom%!20=&2800302E:
- rom$="VSheet"
- full:ver$=" View Sheet 1.0"
- rom%!16=&31006572
- rom%!20=&2800312E:
- rom$="VStore"
- store_11
- rom%!16=&31006572
- rom%!20=&0033312E:
- rom$="VStore"
- full:ver$=" View Store 1.13"
- *** STILL BUGS WHEN rom%!16=&31006572 AND rom%!20=&2800322E:IF rom$="VStore" PROCfull:ver$=" View Store 1.2"
- rom%?&2842=
- rom$="View"
- view_B0
- rom%!&2A58=&00312E33:
- rom$="View"
- full:ver$=" View B3.1"
- rom%!&2878=&00302E33:
- rom$="View"
- view_A0
- rom%!&2A58=&31312E33:
- rom$="View"
- full:ver$=" View B3.11"
- ver$=""
- Don't recognise this version of "rom$
- '" Do you wish to attemp a conversion anyway Y/N ? ";
- ''" Conversion abandoned":
- ''" Try FULL conversion with function key correction Y/N ? ";
- 4! ver$=rom$+", type unknown, "
- full:ver$=ver$+"full"
- ver$=ver$+"partial"
- "copy <Obey$Dir>.Run1 <Obey$Dir>.^.!Run ~V F ~C"
- ========================================================
- Use the following line if you just want to
- convert the ROM and not make it into a Module
- SYS "OS_File",10,"<Obey$Dir>.^.Arc"+rom$,&BBC,,rom%,rom%+&4100:END
- ========================================================
- "OS_File",10,"<Obey$Dir>.^."+rom$+"Mod",&FFA,,buffer%,rom%+&4100
- ''" "ver$" conversion successful."
- ver$,"unknown")
- '" Although the ROM has been converted it may not operate"
- " properly. If there are problems then send me a copy of"
- " it (with SAE please) and I will try to get it to work."
- ===============================================================
- This PROC called for full conversion only. Redirects all OSRDCH
- calls to 'patch' and calls 'patch' before main Language entry
- ===============================================================
- B%=rom%:
- code%
- O;
- poke values for original language entry into patch
- P'rom%?&4066=rom%?1:rom%?&4067=rom%?2
- Q;
- poke new language entry at &C068 into start of ROM
- rom%?1=&68:rom%?2=&C0
- =================================================================
- These are the conversion routines for individulal ROMs. The main
- item disables the routines which deliberately crash the ROM when
- run in RAM. This was intended to stop the program being used in
- SWR on a BBC but it was as useful as every other form of software
- protection, ie. it was no bar to the dishonest and an inconvenience
- to the honest, since you can see how easy it is to remove it!
- =================================================================
- view_A0 :
- For View A3.0
- `*rom%?&CF=&EA:rom%?&D0=&EA:rom%?&D1=&EA
- a0rom%?&28D6=&EA:rom%?&28D7=&EA:rom%?&28D8=&EA
- ver$=" View A3.0"
- view_B0 :
- For View B3.0
- g*rom%?&C2=&EA:rom%?&C3=&EA:rom%?&C4=&EA
- h0rom%?&28A1=&EA:rom%?&28A2=&EA:rom%?&28A3=&EA
- ver$=" View B3.0"
- sheet_B1 :
- For ViewSheet B1.0
- n-rom%?&690=&EA:rom%?&691=&EA:rom%?&692=&EA
- ver$=" View Sheet B1.0"
- store_11 :
- for ViewStore 1.1
- t0rom%?&2BE2=&EA:rom%?&2BE3=&EA:rom%?&2BE4=&EA
- ver$=" View Store 1.1"
- xG ==============================================================
- yC Assembles the code which searches through the ROM code and
- zA redirects all calls to OSrdch to the 'patch' at the end.
- {G Removes all calls to OSbyte &82 to disable 2nd proc relocation
- |G ==============================================================
- assemble
- PASS=4
- P%=0:O%=code%
- [OPT PASS
- 2 add r2,r1,#&4000 ;r2=end of ROM
- 0.loop cmp r1,r2 ;at end yet?
- ; movge pc,r14 ;yes so return to BASIC
- 2 ldrb r0,[r1],#1 ;get next byte
- D cmp r0,#&20 ;is it a JMP or JSR instruction?
- cmpne r0,#&4C
- bne loop
- M ldrb r0,[r1,#1] ;JMP or JSR found, get hi byte of address
- cmp r0,#&FF
- D bne loop ;hi byte not &FF so keep looking
- ; ldrb r0,[r1] ;get lo byte of address
- cmp r0,#&E0
- H moveq r0,#0 ;if it was OSRDCH change it to &C000
- streqb r0,[r1]
- moveq r0,#&C0
- streqb r0,[r1,#1]
- 9 beq loop ;and carry on looking
- 5 cmp r0,#&F4 ;check for OSBYTE
- bne loop
- D ldrb r0,[r1,#-3] ;check if the instruction before
- ; cmp r0,#&A9 ;JSR OSBYTE is LDA #&82
- ldreqb r0,[r1,#-2]
- cmpeq r0,#&82
- 3 bne loop ;not OSBYTE &82
- @ mov r0,#&A2 ;replace LDA#&82 JSR OSBYTE
- ; strb r0,[r1,#-3] ;with LDX#0 LDY#0 NOP
- L mov r0,#0 ;to disable 2nd proc relocation routines
- strb r0,[r1,#-2]
- strb r0,[r1]
- mov r0,#&A0
- strb r0,[r1,#-1]
- mov r0,#&EA
- strb r0,[r1,#1]!
- bal loop
-